using UnityEngine;
using UnityEngine.EventSystems;

public class UIEC_Button_Script : MonoBehaviour,
    IPointerEnterHandler, IPointerExitHandler,
    IPointerDownHandler, IPointerUpHandler,
    IPointerClickHandler,
    IBeginDragHandler, IDragHandler, IEndDragHandler
{
    public void OnPointerEnter(PointerEventData eventData)
    {
        Debug.Log("鼠标进来了...");
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        Debug.Log("鼠标出去了...");
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        Debug.Log("鼠标按下了...");
    }

    /* 鼠标按下和抬起都在该按钮上，才触发 */
    public void OnPointerUp(PointerEventData eventData)
    {
        Debug.Log("鼠标抬起了...");
    }

    /* 鼠标按下和抬起都在该按钮上，才触发 */
    public void OnPointerClick(PointerEventData eventData)
    {
        Debug.Log("鼠标点击了...");
    }

    public void OnBeginDrag(PointerEventData eventData)
    {
        Debug.Log("开始拖拽...");
    }

    public void OnDrag(PointerEventData eventData)
    {
        Debug.Log("正在拖拽...");
        transform.position = Input.mousePosition;
    }

    public void OnEndDrag(PointerEventData eventData)
    {
        Debug.Log("拖拽结束...");
    }
}